// 折线图
export const chart_line = {
	title: {
		text: '',
		textStyle: {
			fontSize: '15'
		}
	},
	tooltip: {
		trigger: 'axis'
	},
	legend: {
		data: ['微信', '支付宝', 'APP']
	},
  // color: ['#34C759', '#347AE2', '#FF9500'],
	grid: {
		left: '3%',
		right: '4%',
		bottom: '3%',
		containLabel: true
	},
	toolbox: {
		right: 30,
		feature: {
			saveAsImage: {}
		}
	},
	xAxis: {
		type: 'category',
		boundaryGap: false,
		data: ['1', '2', '3', '4', '5', '6', '7']
	},
	yAxis: {
		type: 'value',
    minInterval: 1
	},
	series: [
		{
			name: '微信',
			type: 'line',
			smooth: true,
			data: [120, 132, 101, 134, 90, 230, 210]
		},
    {
			name: '支付宝',
			type: 'line',
			smooth: true,
			data: [100, 92, 99, 154, 97, 210, 201]
		},
    {
			name: 'APP',
			type: 'line',
			smooth: true,
			data: [181, 136, 129, 134, 127, 233, 251]
		}
	]
}

// 柱状图
export const chart_bar = {
  title: {
    text: '',
    textStyle: {
			fontSize: '15'
		}
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {
    data: ['Direct']
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  toolbox: {
		right: 30,
		feature: {
			saveAsImage: {}
		}
	},
  xAxis: {
    type: 'category',
    data: ['1', '2', '3', '4', '5', '6'],
    show: true
  },
  yAxis: {
    type: 'value',
    minInterval: 1,
    axisLine: {
      show: true         // 不显示坐标轴刻度线
    },
    axisTick: {
      show: true         // 不显示坐标轴线
    },
  },
  series: [
    {
      name: 'Direct',
      type: 'bar',
      label: {
        show: false,
        color: '#ffffff'
      },
      emphasis: {
        focus: 'series'
      },
      data: [320, 302, 301, 334, 390, 330, 320]
    },
    {
      name: 'Mail Ad',
      type: 'bar',
      label: {
        show: false,
        color: '#ffffff'
      },
      emphasis: {
        focus: 'series'
      },
      data: [120, 132, 101, 134, 90, 230, 210]
    },
    {
      name: 'Affiliate Ad',
      type: 'bar',
      label: {
        show: false,
        color: '#ffffff'
      },
      emphasis: {
        focus: 'series'
      },
      data: [220, 182, 191, 234, 290, 330, 310]
    },
    {
      name: 'Video Ad',
      type: 'bar',
      label: {
        show: false,
        color: '#ffffff'
      },
      emphasis: {
        focus: 'series'
      },
      data: [150, 212, 201, 154, 190, 330, 410]
    },
    {
      name: 'Search Engine',
      type: 'bar',
      label: {
        show: false,
        color: '#ffffff'
      },
      emphasis: {
        focus: 'series'
      },
      data: [820, 832, 901, 934, 1290, 1330, 1320]
    }
  ]
}

// 饼图
export const circle_pie = {
  title: {
    text: '',
    left: 'center'
  },
  tooltip: {
    trigger: 'item',
    // formatter: '{b} : {c} ({d}%)'
    formatter(param) {
      // console.log(param)
      return param.name + "<br />数量：" + param.value + '<br />占比：' + param.percent + '%'
    }
  },
  toolbox: {
		right: 30,
		feature: {
			saveAsImage: {}
		}
	},
  legend: {
    bottom: '5%',
    left: 'center'
  },
  // color: ['#34C759', '#347AE2', '#FF9500'],
  series: [
    {
      name: '',
      type: 'pie',
      center: ['50%', '40%'],
      radius: ['30%', '60%'],
      avoidLabelOverlap: true,
      label: {
        show: true,
        formatter(param) {
          // console.log(param)
          // return `${param.name}：${param.value} (${param.percent}%)`
          return `${param.name}：${param.percent}%`
        }
      },
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      },
      labelLine: {
        show: true
      },
      data: [
        { value: 1048, name: '微信' },
        { value: 735, name: '支付宝' },
        { value: 935, name: 'APP' },
      ]
    }
  ]
}
